Closed
Conversation
Adds a zero-dependency Node.js validator and GitHub Actions workflow that
runs on push to any branch and on PRs to main.
The validator checks:
- marketplace.json: valid JSON, non-empty plugins array, required fields
(name, source, description), and that each source is either a "./"
relative path or a { source: "github", repo: "owner/name" } object
- plugin.json: valid JSON and required name/description fields
This would have caught the "source: ." bug before it merged.
Actions pinned to full commit SHAs per security best practices.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="scripts/validate-marketplace.js">
<violation number="1" location="scripts/validate-marketplace.js:113">
P2: Guard `plugins` entries before accessing `plugin.*` to avoid a TypeError when an entry is `null` or a non-object, and emit a clear validation error instead of crashing.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| let allValid = true; | ||
| for (const [i, plugin] of data.plugins.entries()) { | ||
| const label = plugin.name ?? `[${i}]`; |
There was a problem hiding this comment.
P2: Guard plugins entries before accessing plugin.* to avoid a TypeError when an entry is null or a non-object, and emit a clear validation error instead of crashing.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/validate-marketplace.js, line 113:
<comment>Guard `plugins` entries before accessing `plugin.*` to avoid a TypeError when an entry is `null` or a non-object, and emit a clear validation error instead of crashing.</comment>
<file context>
@@ -0,0 +1,183 @@
+
+ let allValid = true;
+ for (const [i, plugin] of data.plugins.entries()) {
+ const label = plugin.name ?? `[${i}]`;
+
+ if (typeof plugin.name !== "string" || !plugin.name) {
</file context>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/validate-marketplace.js).github/workflows/validate.yml) that runs on every push and PR to mainWhat it validates
marketplace.jsonpluginsis a non-empty arraynameanddescriptionas non-empty stringssourceis either:"./"(relative path to local plugin dir){ source: "github", repo: "owner/name", path?: "..." }tags, if present, is an array of stringsplugin.json(optional, validated if present)nameanddescriptionas non-empty stringsMotivation
This would have caught the bug fixed in #1 before it merged —
"source": "."is now explicitly rejected with a clear message explaining the valid formats.Test plan
node scripts/validate-marketplace.jspasses locally on current manifests"source": "."value is caught and reported🤖 Generated with Claude Code
Summary by cubic
Adds CI validation for plugin manifests to prevent invalid entries from merging. A zero-dependency Node script checks marketplace.json and plugin.json on every push and PR.
Written for commit f5b3332. Summary will update on new commits.